home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 051-075 / disk_069 / sb / sbgadget.c < prev    next >
C/C++ Source or Header  |  1992-05-06  |  4KB  |  105 lines

  1. /* include not needed for Aztec C using provided makefile */
  2. #include "sb:sb.h"
  3. extern int level;
  4.  
  5.  
  6. void PrGadget(string, gadget) char *string; struct Gadget *gadget;
  7. {
  8. static struct StructData structdata[] = {
  9.      { " NextGadget",   "struct Gadget *",     5, PTRSIZE },
  10.      { "-LeftEdge",     "SHORT",               2, INTSIZE },
  11.      { "-TopEdge",      "SHORT",               2, INTSIZE },
  12.      { "-Width",        "SHORT",               2, INTSIZE },
  13.      { "-Height",       "SHORT",               2, INTSIZE },
  14.      { " Flags",        "USHORT",             12, INTSIZE },
  15.      { " Activation",   "USHORT",             12, INTSIZE },
  16.      { " GadgetType",   "USHORT",             12, INTSIZE },
  17.      { "(GadgetRender", "APTR)",               5, PTRSIZE },
  18.      { "(SelectRender", "APTR)",               5, PTRSIZE },
  19.      { " GadgetText",   "struct IntuiText *",  5, PTRSIZE },
  20.      { "-MutualExclude","LONG",                1, PTRSIZE },
  21.      { "(SpecialInfo",  "APTR)",               5, PTRSIZE },
  22.      { "-GadgetID",     "USHORT",             12, INTSIZE },
  23.      { "-UserData",     "APTR",                5, PTRSIZE }
  24.   };
  25. static char *flagnames[16] = {
  26.      "GADGHBOX",       "GADGHIMAGE",    "GADGIMAGE",      "GRELBOTTOM",
  27.      "GRELRIGHT",      "GRELWIDTH",     "GRELHEIGHT",     "SELECTED",
  28.      "GADGDISABLED"
  29.   };
  30. static char *activatenames[16] = {
  31.      "RELVERIFY",      "GADGIMMEDIATE", "ENDGADGET",      "FOLLOWMOUSE",
  32.      "RIGHTBORDER",    "LEFTBORDER",    "TOPBORDER",      "BOTTOMBORDER",
  33.      "TOGGLESELECT",   "STRINGCENTER",  "STRINGRIGHT",    "LONGINT",
  34.      "ALTKEYMAP",      "BOOLEXTEND"
  35.   };
  36. static char *systypenames[16] = {
  37.      "SIZING",         "WDRAGGING",     "SDRAGGING",      "WUPFRONT",
  38.      "SUPFRONT",       "WDOWNBACK",     "SDOWNBACK",      "CLOSE",
  39.      NULL,             NULL,            NULL,             NULL,
  40.      "REQGADGET",      "GZZGADGET",     "SCRGADGET",      "SYSGADET"
  41.   };
  42. static char *applitypenames[16] = {
  43.      "BOOLGADGET",     "GADGET0002",    "PROPGADGET",     "STRGADGET",
  44.      NULL,             NULL,            NULL,             NULL,
  45.      NULL,             NULL,            NULL,             NULL,
  46.      "REQGADGET",      "GZZGADGET",     "SCRGADGET",      "SYSGADGET"
  47.   };
  48. int sum, choice = -1;
  49. USHORT bits;
  50.   level++;
  51.   while (choice) {
  52.     sum = SetOptionText(string, structdata,
  53.                         (APTR)gadget, DATASIZE, 0);
  54.     switch (choice = GetChoice(DATASIZE)) {
  55.       case 1:
  56.         if (gadget->NextGadget)
  57.           PrGadget("The next gadget in Intuition's list", gadget->NextGadget);
  58.         break;
  59.       case 6:
  60.         bits = gadget->Flags;
  61.         switch (bits & GADGHIGHBITS) {
  62.           case 0:
  63.             flagnames[0] = "GADGHCOMP";
  64.             bits |= 0x01;
  65.             break;
  66.           case 1:
  67.             flagnames[0] = "GADGHBOX";
  68.             break;
  69.           case 2:
  70.             flagnames[1] = "GADGHIMAGE";
  71.             break;
  72.           case 3:
  73.             flagnames[1] = "GADGHNONE";
  74.             bits ^= 0x01;
  75.             break;
  76.         }
  77.         FlagPrint("Flags set for this gadget", flagnames, (ULONG)bits);
  78.         break;
  79.       case 7:
  80.         FlagPrint("Activation flags set for this gadget",
  81.                   activatenames, (ULONG)gadget->Activation);
  82.         break;
  83.       case 8:
  84.         bits = gadget->GadgetType;
  85.         if (bits & SYSGADGET) {
  86.           bits = (bits & 0xff00) | (1 << (((bits & 0xf0) >> 4) - 1));
  87.           FlagPrint("Gadget type flags set for this gadget",
  88.                 systypenames, (ULONG)bits);
  89.         }
  90.         else {
  91.           bits = (bits & 0xff00) | (1 << ((bits & 0x0f) - 1));
  92.           FlagPrint("Gadget type flags set for this gadget",
  93.                 applitypenames, (ULONG)bits);
  94.         }
  95.         break;
  96.       case 11:
  97.         if (gadget->GadgetText)
  98.           PrIntuiText("The gadget's first text (IntuiText structure)",
  99.                       gadget->GadgetText);
  100.         break;
  101.     }
  102.   }
  103.   level--;
  104. }
  105.